package com.example.restful.controller;

import com.example.restful.exception.BusinessException;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.xml.bind.ValidationException;

/**
 * Copyright(C), 2020-2021, AmbroseCdMeng
 * FileName:    TestController
 * Author:      AmbroseCdMeng
 * Date:        2021/2/118:38
 * Description: 测试异常类
 * History:
 * <author>     <time>      <version>       <desc>
 * 作者姓名     修改时间        版本号           描述
 */
@RestController
public class TestController {
    @RequestMapping("/businessException")
    public String testResponseStatusExceptionResolver(@RequestParam("i") int i) throws BusinessException, ValidationException {
        if (i == 0)
            throw new BusinessException(600, "自定义业务错误");
        throw new ValidationException("");
    }
}
